package hanjia;

/**
 * Description:
 * Author:    Dane
 * CreateTime:2025/2/17-下午12:21
 * Since  :   1.0
 * Version:   1.0
 */
public class LeetCode55 {

    public boolean canJump(int[] nums) {

        if(nums.length==1){
            return true;
        }

        int max=0;
        for (int i=0;i<nums.length-1;i++){
            if (i<=max){
                max=Math.max(max,i+nums[i]);
                if (max>=nums.length-1){
                    return true;
                }
            }else {
                return false;
            }


        }
        return false;

    }
}
